﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DomainDrive.Core.Interface;

namespace Esb.Domain.DomainObjects
{
    /// <summary>
    /// 记录Esb管理员的操作日志
    /// </summary>
    public class OperationLogDo : IAggregateRoot<int>
    {
        /// <summary>
        /// 主键
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 管理员Id
        /// </summary>
        public string UserId { get; private set; }

        /// <summary>
        /// 管理员账号
        /// </summary>
        public string UserName { get; private set; }

        /// <summary>
        /// 操作时间
        /// </summary>
        public DateTime OperationTime { get; private set; }

        public string ServiceName { get; private set; }

        public int ServiceId { get; private set; }

        public OperationType OperationType { get; private set; }

        public OperationLogDo(string userId, string userName, int serviceId, string serviceName, OperationType operationType)
        {
            this.UserId = userId;
            this.UserName = userName;
            this.ServiceName = serviceName;
            this.ServiceId = serviceId;
            this.OperationType = operationType;
            this.OperationTime = DateTime.Now;
        }

        public OperationLogDo()
        {
 
        }

        /// <summary>
        /// 删除
        /// </summary>
        /// <returns></returns>
        public bool Delete()
        {
            return true;
        }
    }

    /// <summary>
    /// 操作类型枚举
    /// </summary>
    public enum OperationType
    {
        //新增
        Register,

        //修改
        Update,

        //删除
        Delete,
    }
}
